<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">

<head>
    <meta charset="utf-8"/>
    <title>订单查询</title>
    <meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <meta name="description" content=""/>
    <meta name="author" content=""/>
    <link rel="stylesheet" type="text/css" href="/static/theme.css"/>
    <script th:src="@{/static/jquery-1.7.2.js}" type="text/javascript"></script>


</head>
<body class="">


<div class="sidebar-nav">
    <a href="#dashboard-menu" class="nav-header" data-toggle="collapse"><i class="icon-dashboard"></i>订单管理</a>

    <ul>
        <li><a href="/addOrder">新增订单</a></li>
        <li><a href="/queryOrder">查询订单</a></li>
    </ul>


</div>


<div class="content">
    <table border="1">
        <tr>

            <th>订单编号</th>
            <th>商品名称</th>
            <th>商品数量</th>
            <th>金额</th>
            <th>买家ID</th>
            <th>买家称号</th>
            <th>订单创建时间</th>
            <th>订单创建日期</th>
            <th>修改日期</th>
            <th></th>
            <th></th>
        </tr>
        <tr th:each="order : ${ordersList}">

            <td th:text="${order.orderId}"></td>
            <td th:text="${order.goodsId}"></td>
            <td th:text="${order.number}"></td>
            <td th:text="${#numbers.formatDecimal(order.price, 0, 2)}"></td>
            <td th:text="${order.userId}"></td>
            <td th:text="${order.userName}"></td>
            <td th:text="${#dates.format(order.createdTime, 'yyyy-MM-dd HH:mm')}"></td>
            <td th:text="${#dates.format(order.createdDate, 'yyyy-MM-dd ')}"></td>
            <td th:text="${order.updatedTime==null? '': #dates.format(order.updatedTime, 'yyyy-MM-dd HH:mm')}"></td>
            <td><a class="" th:href="@{/toModify/}+${order.orderId}">
                <button>修改</button>
            </a>
            </td>
            <!--<td><a class="" th:href="@{/deleteOrder/}+${order.orderId}">
                <button >删除</button></a>
            </td>-->
            <td><a th:href="@{/deleteOrder/}+${order.orderId}" onclick="return del()">
                <button>删除</button>
            </a>
            </td>
        </tr>
    </table>

</div>
<script>
    function del() {
        if (confirm('确定删除吗？')) {

            return true;
        } else {
            return false;
        }
    }
    var formatMoney = function (value, type) {
        if (value == null || value == '') {
            return '';
        }
        if (type == null || type == '') {
            type  = 2;
        }
        return value.toFixed(type).replace(/(\d)(?=(\d{3})+\.)/g, '$1,');
    };

</script>
</body>
</html>


